import { useState, Fragment } from "react";
import styled from "styled-components";
import { Input } from "antd";
const Scene = styled.div`
  width: 100%;
  height: 100%;
  background: #76b852;
  background: -webkit-linear-gradient(to left, #76b852, #8dc26f);
  background: -webkit-linear-gradient(right, #76b852, #8dc26f);
  background: linear-gradient(to left, #76b852, #8dc26f);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  -ms-flex-pack: center;
  justify-content: center;
  -webkit-box-align: center;
  -webkit-align-items: center;
  -ms-flex-align: center;
  align-items: center;
`;
const Span = styled.span<{ index: number }>`
  position: relative;
  top: 20px;
  display: inline-block;
  -webkit-animation: bounce 0.3s ease infinite alternate;
  animation: bounce 0.3s ease infinite alternate;
  font-family: "Titan One", cursive;
  font-size: 80px;
  color: #fff;
  text-shadow: 0 1px 0 #ccc, 0 2px 0 #ccc, 0 3px 0 #ccc, 0 4px 0 #ccc,
    0 5px 0 #ccc, 0 6px 0 transparent, 0 7px 0 transparent, 0 8px 0 transparent,
    0 9px 0 transparent, 0 10px 10px rgba(0, 0, 0, 0.4);
  -webkit-animation-delay: ${(props) => props.index}s;
  animation-delay: ${(props) => props.index}s;
  @-webkit-keyframes bounce {
    100% {
      top: -20px;
      text-shadow: 0 1px 0 #ccc, 0 2px 0 #ccc, 0 3px 0 #ccc, 0 4px 0 #ccc,
        0 5px 0 #ccc, 0 6px 0 #ccc, 0 7px 0 #ccc, 0 8px 0 #ccc, 0 9px 0 #ccc,
        0 50px 25px rgba(0, 0, 0, 0.2);
    }
  }

  @keyframes bounce {
    100% {
      top: -20px;
      text-shadow: 0 1px 0 #ccc, 0 2px 0 #ccc, 0 3px 0 #ccc, 0 4px 0 #ccc,
        0 5px 0 #ccc, 0 6px 0 #ccc, 0 7px 0 #ccc, 0 8px 0 #ccc, 0 9px 0 #ccc,
        0 50px 25px rgba(0, 0, 0, 0.2);
    }
  }
`;
function App() {
  const [text, setText] = useState("前端工具集合！");
  const onChange = (val: React.ChangeEvent<HTMLInputElement>) => {
    setText(val.target.value)
  };
  return (
    <Fragment>
      <Input
        placeholder="输入文字"
        onChange={onChange}
        style={{ width: "200px" }}
      ></Input>
      <Scene>
        <h1>
          {text.split("").map((i, index) => (
            <Span index={index * 0.1} key={index}>
              {i}
            </Span>
          ))}
        </h1>
      </Scene>
    </Fragment>
  );
}

export default App;
